package com.cloudbroker.openapi.manage.controller;

import static com.cloudbroker.bcs.platform.dav.common.util.RequestUtil.getSingleParameterMapForBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.cloudbroker.bcs.common.entity.HSBCPSBackVO;
import com.cloudbroker.bcs.common.util.VOUtil;
import com.cloudbroker.bcs.platform.dav.bizapi.service.business.plugs.result.PlugsDavListResult;
import com.cloudbroker.bcs.platform.dav.bizapi.service.business.plugs.vo.PlugsDelForm;
import com.cloudbroker.bcs.platform.dav.bizapi.service.business.plugs.vo.PlugsForm;
import com.cloudbroker.bcs.platform.dav.bizapi.service.business.plugs.vo.PlugsListForm;
import com.cloudbroker.bcs.platform.dav.bizapi.t2service.business.PlugsT2BizService;
import com.cloudbroker.bcs.platform.dav.common.ext.annotation.SaveLog;
@Controller
public class PlugsController {

	@Resource
	private PlugsT2BizService plugsT2;
	
	@ResponseBody
	@RequestMapping("func_plugs_save")
	@SaveLog(remark = "组件添加")
	public HSBCPSBackVO funcPlugsSave(HttpServletRequest request,String jsonpcallback){
		PlugsForm form = getSingleParameterMapForBody(request,PlugsForm.class);
		return VOUtil.setJsonpResult(plugsT2.funcPLugsSave(form), jsonpcallback);
	}
	
	@ResponseBody
	@RequestMapping("func_plugs_update")
	@SaveLog(remark = "组件修改")
	public HSBCPSBackVO funcPlugsUpdate(HttpServletRequest request,String jsonpcallback){
	    PlugsForm form = getSingleParameterMapForBody(request,PlugsForm.class);
		return VOUtil.setJsonpResult(plugsT2.funcPlugsUpdate(form), jsonpcallback);
	}
	
	@ResponseBody
	@RequestMapping("func_plugs_list")
	@SaveLog(remark = "组件列表")
	public PlugsDavListResult funcPlugsList(HttpServletRequest request,String jsonpcallback){
		PlugsListForm form = getSingleParameterMapForBody(request,PlugsListForm.class);
		return VOUtil.setJsonpResult(plugsT2.funcPlugsList(form), jsonpcallback);
	}
	
	@ResponseBody
	@RequestMapping("func_plugs_del")
	@SaveLog(remark = "删除组件")
	public HSBCPSBackVO funcPlugsDel(HttpServletRequest request,String jsonpcallback){
		PlugsDelForm form = getSingleParameterMapForBody(request,PlugsDelForm.class);
		return VOUtil.setJsonpResult(plugsT2.funcPlugsDel(form), jsonpcallback);
	}
}
